﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNCDataSetTableAdapters;

public partial class Admin_Default : System.Web.UI.Page
{
    MembersTableAdapter mem = new MembersTableAdapter();
    string role = "admin";
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["username"] = null;
        Session["password"] = null;
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        
        int i = Convert.ToInt32(mem.CheckLogin(txtUsername.Text, txtPassword.Text, role));
        if (i == 1)
        {
            Session["username"] = txtUsername.Text;
            Session["role"] = role;
            Session["msg"] = "";
            Response.Redirect("~/Admin/Home/Info.aspx");
        }
        else
        {
            Response.Write("<script>alert('Thông tin đăng nhập không đúng.')</script>");
            return;
        }
    }
}